<?php

use App\Handlers\SwooleHandler;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});

// Route::get('/1001', function () {
//     $t1 = microtime(true);
//     $SwooleHandler = new  SwooleHandler();
//     //$data =  rc4(config('other.a_key'), '{"type": 1001,"request": {"guid":123123,"user_type":"1","key":"5ebabc776ad47f91d4e29ff63de75e64"}}');
//     $data = '';
//     $d = $SwooleHandler->onReceive('', '', '', $data);
//     $list = $d;
//     $cc = $data;
//     $t2 = microtime(true);
//     $t3 = (($t2 - $t1) * 1000) . 'ms';
//     dd([$cc, $list, $t3]);
//     return view('welcome');
// });


Route::group(['namespace' => 'Index'], function () {
    Route::get('get/test', 'TestController@getApiInfo')->name('get.test');

    Route::get('/', 'HomeController@index')->name('index');
    Route::get('home', 'HomeController@index')->name('index');

});
Route::group(['namespace' => 'Index'], function () {

    Route::get('qqlogin','LoginController@qqlogin');
    Route::get('qq','LoginController@qq');
    Route::get('account_login','LoginController@accountLogin');
    Route::get('index/logout','LoginController@logout')->name('index.logout');

    Route::any('weixin/index', 'WeiXinController@index')->name('weixin.index');

    //实时获取数据->middleware('auth.stocks')
    Route::get('stock_real_time', 'StockController@stockRealTime')->name('stock_real_time');
    Route::get('get_stock_real_time', 'StockController@getStockRealTime')->name('get_stock_real_time');

    Route::get('get_stock_num', 'StockController@getStockNum')->name('get_stock_num');//获取指数
    Route::get('stock_forum', 'StockController@stockForum')->name('stock_forum');//论坛数据页面
    Route::get('get_stock_forum', 'StockController@getStockForum')->name('get_stock_forum');//获取数据
    Route::get('stock_forum_info', 'StockController@getStockForumInfo')->name('stock_forum_info');//获取详情

    Route::get('get_stock_info', 'StockController@getStockInfo')->name('get_stock_info');
    Route::get('get_stock_all', 'StockController@getStockAll')->name('get_stock_all');
    Route::get('get_pe_data', 'StockController@getPeData')->name('get_pe_data');
    Route::get('fund_loop_back', 'StockController@fundLoopBack')->name('fund_loop_back');
    Route::get('get_fund_loop_back', 'StockController@getFundLoopBack')->name('get_fund_loop_back');

    //K线页面
    Route::get('k_line', 'StockController@kLine')->name('k_line');
    Route::get('get_k_line', 'StockController@getKLine')->name('get_k_line');
    //资金详情
    Route::get('cost_line', 'StockController@costLine')->name('cost_line');
    //获取数据
    Route::get('get_cost_line', 'StockController@getCostLine')->name('get_cost_line');

    //研报社文章
    Route::prefix('article_stock')->group(function () {
        Route::get('index', 'ArticleStockController@index')->name('article_stock.index');
        Route::get('search', 'ArticleStockController@search')->name('article_stock.search');
        Route::get('show', 'ArticleStockController@show')->name('article_stock.show');
        Route::get('read/{id}', 'ArticleStockController@read')->name('article_stock.read');
    });
    Route::prefix('article')->group(function () {
        Route::get('index', 'ArticleController@index')->name('article.index');
        Route::get('place_index', 'ArticleController@place_index')->name('article.place_index');
        Route::get('search', 'ArticleController@search')->name('article.search');
        Route::get('show', 'ArticleController@show')->name('article.show');
        Route::get('place_show', 'ArticleController@place_show')->name('article.place_show');
        Route::get('read/{id}', 'ArticleController@read')->name('article.read');
    });

    Route::prefix('news')->group(function () {
        Route::get('index', 'NewController@index')->name('news.index');
        Route::get('show', 'NewController@show')->name('news.show');
    });

    Route::prefix('user')->group(function () {
        Route::get('wx_auth', 'WeChatController@getWeChatQr')->name('user.wx_auth');
        Route::get('stocks_login', 'UserController@stocksLogin')->name('user.stocks_login');

        Route::post('stocks_login_handel', 'UserController@stocksLoginHandle')->name('user.stocks_login_handel');
    });
    Route::prefix('about')->group(function () {
        Route::get('index', 'AboutController@index')->name('about.index');
    });


});
